package com.lqfan.autoAnswerQ.thread;

public class MyRunable implements  Runnable{
    public  static  int good =100;
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName());
        while (true){
            send();
        }
    }
    public synchronized  void  send(){
        if (good>0){
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName()+"卖出"+good--);
        }
    }
}
